﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/Principal.master" AutoEventWireup="true" CodeFile="TiposDeIngrediente.aspx.cs" Inherits="TiposDeIngrediente" %>

<%@ OutputCache Duration="1" Location="none" %>
<%@ Register Src="MenusDePagina/WebUserControlMenuAdministracion.ascx" TagName="WebUserControlMenuAdministracion"
    TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
    <uc1:WebUserControlMenuAdministracion ID="WebUserControlMenuAdministracion1" runat="server" />
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <h1>Caracterizacion de Productos</h1>
    
    <asp:Panel ID="Panel1" runat="server">
        <asp:Label ID="Label1" runat="server"></asp:Label>
    </asp:Panel>
    
  <asp:FormView ID="FormViewTipoDeIngrediente" runat="server" 
        DataSourceID="ObjectDataSourceTipoDeIngrediente" DefaultMode="Insert" 
        HorizontalAlign="Center" Visible="False">
        <InsertItemTemplate>
            <table class="detalle">
                <thead>
                    <tr>
                        <td colspan="2">
                            Adicionar movimiento</td>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td>
                            Nombre:</td>
                        <td>
                            <asp:TextBox ID="NombreTextBox" runat="server" Text='<%# Bind("Nombre") %>' MaxLength="50" />
                            <asp:RequiredFieldValidator ID="RequiredFieldValidatorTipoDeIngrediente" 
                                runat="server" ControlToValidate="NombreTextBox" 
                                ErrorMessage="El nombre del tipo de ingrediente es obligatorio" 
                                ValidationGroup="Validadores">*</asp:RequiredFieldValidator>
                        </td>
                    </tr>
                </tbody>
                <tfoot>
                    <tr>
                        <td colspan="2">
                            <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                                CommandName="Insert" Text="Insertar" ValidationGroup="Validadores" />
                            &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                                CausesValidation="False" CommandName="Cancel" 
                                onclick="InsertCancelButton_Click" Text="Cancelar" />
                        </td>
                    </tr>
                </tfoot>
            </table>
            &nbsp;
        </InsertItemTemplate>
    </asp:FormView>
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
        AutoGenerateColumns="False" CellPadding="4" CssClass="detalle" 
        DataKeyNames="Codigo" DataSourceID="ObjectDataSourceTipoDeIngrediente" 
        ForeColor="#333333" GridLines="None" HorizontalAlign="Center">
        <RowStyle BackColor="#EFF3FB" />
        <Columns>
            <asp:TemplateField ShowHeader="False">
                <EditItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" 
                        CommandName="Update" Text="Actualizar" ValidationGroup="Validadores1"></asp:LinkButton>
                    &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                        CommandName="Cancel" Text="Cancelar"></asp:LinkButton>
                </EditItemTemplate>
                <HeaderTemplate>
                    <asp:LinkButton ID="LinkButtonNuevo" runat="server" 
                        onclick="LinkButtonNuevo_Click">Adicionar nuevo</asp:LinkButton>
                </HeaderTemplate>
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" 
                        CommandName="Edit" Text="Editar"></asp:LinkButton>
                    &nbsp;<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" 
                        CommandName="Delete" Text="Eliminar" OnClientClick="javascript:return ConfirmDel(this);"></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="Codigo" HeaderText="Codigo" ReadOnly="True" 
                SortExpression="Codigo" />
           
            <asp:TemplateField HeaderText="Nombre" SortExpression="Nombre">
                <EditItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Nombre") %>'></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                        ControlToValidate="TextBox1" ErrorMessage="Campo obligatorio" 
                        ValidationGroup="Validadores1"></asp:RequiredFieldValidator>
                </EditItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("Nombre") %>'></asp:Label>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <EmptyDataTemplate>
            No hay datos acerca de Tipo de Ingrediente
            <br />
            <asp:LinkButton ID="LinkButtonNuevo" runat="server" 
                onclick="LinkButtonNuevo_Click">Nuevo</asp:LinkButton>
        </EmptyDataTemplate>
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <EditRowStyle BackColor="#2461BF" />
        <AlternatingRowStyle BackColor="White" />
    </asp:GridView>
    
    <asp:ObjectDataSource ID="ObjectDataSourceTipoDeIngrediente" runat="server" 
        DeleteMethod="eliminarTipoDeIngrediente" InsertMethod="crearTipoDeIngrediente" 
        SelectMethod="consultarTiposDeIngrediente" 
        TypeName="Libreria.SIG.Negocio.TipoDeIngredienteNegocio" 
        ondeleted="ObjectDataSourceTipoDeIngrediente_Deleted" 
        UpdateMethod="actualizarTipoDeIngrediente">
        <DeleteParameters>
            <asp:Parameter Name="Codigo" Type="Int32" />
            <asp:Parameter Name="cadenaDeConexion" Type="String" />
            <asp:Parameter Direction="Output" Name="alert" Type="String" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="Nombre" Type="String" />
            <asp:Parameter Name="cadenaDeConexion" Type="String" />
            <asp:Parameter Name="codigoConvertido" Type="Int32" />
            <asp:Parameter Name="Codigo" Type="Int32" />
        </UpdateParameters>
        <SelectParameters>
            <asp:SessionParameter Name="cadenaDeConexion" SessionField="CadenaDeConexion" 
                Type="String" />
        </SelectParameters>
        <InsertParameters>
            <asp:Parameter Name="Nombre" Type="String" />
            <asp:Parameter Name="cadenaDeConexion" Type="String" />
            <asp:Parameter Name="Codigo" Type="Int32" />
        </InsertParameters>
    </asp:ObjectDataSource>
    </div>
</asp:Content>

